<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix='fmt' %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> 
<html>

<title>产品列表</title>

<c:if test="${empty param.categorycount}">
    <c:set var="categorycount" scope="page" value="100"/>
</c:if>
 
<c:if test="${!empty param.categorycount}">
    <c:set var="categorycount" scope="page" value="${param.categorycount}"/>
</c:if>
<div class="homepageCategoryProducts">
	<c:forEach items="${categories}" var="c" varStatus="stc">
		<c:if test="${stc.count<=categorycount}">
			<div class="eachHomepageCategoryProducts">
				<div class="left-mark"></div>
				<span class="categoryTitle">${c.name}</span>
				<br />
				<c:forEach items="${c.products}" var = "p" varStatus="st">
					<c:if test="${st.count<=5}">
						<div class="productItem">
							<a href="foreproduct?product.id=${p.id}"><img width="100px" src="img/productSingle_middle/${p.firstProductImage.id}.jpg"></a>
                            <a class="productItemDescLink" href="foreproduct?product.id=${p.id}">
                                <span class="productItemDesc">[热销]
                                ${fn:substring(p.name, 0, 20)}
                                </span>
                            </a>
                            <span class="productPrice">
                                ¥<fmt:formatNumber type="number" value="${p.promotePrice}" minFractionDigits="2"/>
                            </span>
						</div>
					</c:if>
				</c:forEach>
				<div style="clear:both" ></div>
			</div>
		</c:if>
	</c:forEach>
	<img src="./img/site/end.png" class="endpng" id="endpng" />
</div>
</html>